package com.xinqi.controller;

import com.xinqi.common.R;
import com.xinqi.service.BlogService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xin麒
 * @date 2023/3/1 15:33
 */
@RestController
@RequestMapping("/blog")
public class BlogController {
    @Resource
    private BlogService blogService;
    @PutMapping("/like/{id}/{userId}")
    public R likeBlog(@PathVariable("id") Long id, @PathVariable("userId") Long userId) {
        // 修改点赞数量
        return blogService.likeBlog(id, userId);
    }
    @GetMapping("/likes/{id}")
    public R queryBlogLikes(@PathVariable("id") Long id){
        return blogService.queryBlogLikes(id);
    }
}
